package cn.zxf.note.common.utils;

import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.Date;

/**
 * 时间帮助类
 * <br/>
 * Created by ZXFeng on 2022/4/29.
 */
public class DateUtils {

    /*** 到今天的间隔天数 */
    public static int intervalDays(Date date) {
        LocalDate now = LocalDate.now();
        LocalDate target = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        return (int) target.until(now, ChronoUnit.DAYS);
    }

}
